package org.gwt.pluginframework.exceptionhandler.client;

import org.gwt.pluginframework.common.Plugin;
import org.gwt.pluginframework.common.event.CommonEvents;
import org.gwt.pluginframework.common.event.IPluginEvent;
import org.gwt.pluginframework.common.event.PluginEventHandler;

import com.google.gwt.user.client.Window;

public class ExceptionHandlingPlugin extends Plugin {

	private static final long serialVersionUID = -2470053036059616334L;

	public void setupManifest() {
		manifest.setName("ExceptionHandlingPlugin");
		manifest.setVersion("1.0");
		manifest.setComment("My new Exception Handling Plugin plugin!");
	}
	
	@Override
	public void onInitialize() {
		registerEventHandler(new PluginEventHandler(CommonEvents.EXCEPTION_EVENT) {
			public void handle(IPluginEvent event) {
				Window.alert("Exception occured! " + event.getParameters().get(CommonEvents.EXCEPTION_PARAMETER));
			}
		});
	}
}
